﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using SPFarmModeler.Common;
using SPFarmModeler.Business;
using SPFarmModeler.Forms;

namespace SPFarmModeler.UserControls
{
    public partial class SPServiceCell : UserControl
    {
        private SPService Svc;

        public bool IsChecked  
        {
            get
            {
                return (Check.CheckState == CheckState.Checked);
            }
            set
            {
                if (value) Check.CheckState = CheckState.Checked;
                else Check.CheckState = CheckState.Unchecked;
            }
        }

        public SPServiceCell(SPService svc)
        {
            InitializeComponent();
        }

        private void Check_CheckedChanged(object sender, EventArgs e)
        {
            if (Svc != null) Parameters.Enabled = this.IsChecked;
        }

        private void Parameters_Click(object sender, EventArgs e)
        {
            if (Svc == null) return;
            EditSPService form = new EditSPService(Svc);
            form.ShowDialog();
        }
    }
}
